package com.hone.honewed.service.zoneWed.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.eig.common.entity.homepageentity.prefecture.EduCourse;
import com.eig.common.entity.homepageentity.prefecture.TbZone;
import com.eig.common.vo.Result;
import com.hone.honewed.dao.zoneWed.ZoneWedDao;
import com.hone.honewed.service.zoneWed.ZoneWedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：YQ袁（2446806940@qq.com）
 * @date ：Created in 2022/12/27 17:05
 * @description：
 * @modified By：
 * @version:
 */
@Service
public class ZoneWedServiceImpl implements ZoneWedService {
    @Autowired
    private ZoneWedDao zoneWedDao;
    @Override
    public Result getAllQianZone() {
        QueryWrapper<TbZone> wrapper = new QueryWrapper<>();
        wrapper.eq("is_deleted",0);
        wrapper.eq("is_disable",0);
        List<TbZone> tbZones = zoneWedDao.selectList(wrapper);
        //遍历
        for (TbZone tbZone : tbZones) {
            List<EduCourse> eduCourses = zoneWedDao.courseList(tbZone.getId());
            tbZone.setCourseList(eduCourses);
        }

        return new Result<>(2000,"查询成功",tbZones);
    }
}
